const path = require('path')
const fs = require('fs')

fs.readFile(path.join(__dirname, 'data/data.json'), (err, data) => {

    let n = JSON.parse(data.toString())
    let nv = n.filter((item => item.gender === '女'))
    let nan = n.filter((item => item.gender === '男'))

    fs.writeFile(path.join(__dirname, 'data/女.json'), JSON.stringify(nv), err => {
        console.log(err)
    })
    fs.writeFile(path.join(__dirname, 'data/男.json'), JSON.stringify(nan), err => {
        console.log(err)
    })
})

